package com.vne.skyemart.model;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class PermissionId implements Serializable{
	private static final long serialVersionUID = 6508779457808051190L;
	
	private Screen screen;
	private Groups groups;
	
    @ManyToOne
	public Screen getScreen() {
		return screen;
	}
	public void setScreen(Screen screen) {
		this.screen = screen;
	}
	@ManyToOne
	public Groups getGroups() {
		return groups;
	}
	public void setGroups(Groups groups) {
		this.groups = groups;
	}
	
	public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
 
        PermissionId that = (PermissionId) o;
 
        if (screen != null ? !screen.equals(that.screen) : that.screen != null) return false;
        if (groups != null ? !groups.equals(that.groups) : that.groups != null)
            return false;
 
        return true;
    }
 
    public int hashCode() {
        int result;
        result = (screen != null ? screen.hashCode() : 0);
        result = 31 * result + (groups != null ? groups.hashCode() : 0);
        return result;
    }
	
}
